package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>
 * 
 * <p>Description: </p>
 *
 * <p>Copyright (c) 2007</p>
 *
 * @author Andrew Carter
 * @version 
 */

import com.jme.bounding.BoundingVolume;

/**
 * Enumerates the permissible bounding volume types.
 * 
 * @author Andrew Carter
 */
public enum E_BoundingVolume {

	NONE("None", ""),

	BOX("Bounding Box", "BoundingBox"),

	CAPSULE("Bounding Capsule", "BoundingCapsule"),

	SPHERE("Bounding Sphere", "BoundingSphere"),

	ORIENTEDBOX("Oriented Box", "OrientedBoundingBox");

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private String value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_BoundingVolume(String name, String value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_BoundingVolume getConstant(String name) {

		for (E_BoundingVolume constant : E_BoundingVolume.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_BoundingVolume getConstant(BoundingVolume type) {

		if (type != null) {
			
			for (E_BoundingVolume constant : E_BoundingVolume.values()) {

				if (constant.getType().compareToIgnoreCase(type.getClass().getSimpleName()) == 0)
					return constant;
			}
		}
		
		return NONE;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * @return 
	 */
	public String getType() {

		return value;
	}
}
